//
//  MaintenanceMgmtViewController.h
//  FMS
//
//  Created by Steven on 10/11/13.
//  Copyright (c) 2013 QGSVN. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FilterViewController.h"

enum {
    inspection_tag,
    maintenance_tag
};

@protocol FilterViewDelegate;

@interface MaintenanceMgmtViewController : UIViewController <UITableViewDataSource,UITableViewDelegate,FilterViewDelegate> {
    NSDictionary *dictLanguage;
    NSMutableArray *inspectionArray;
    NSMutableArray *maintenanceArray;
    int currentSelectedIndex;
    
    UIPopoverController *popoverController;
    int currentFilterMaintenanceIndex;
    
    NSMutableDictionary *permissionDict;
    NSMutableDictionary *maintenancePermissionDict;
    
    int currentRecordIndex;
    BOOL isLoadMore;
    BOOL didReadyLoadMore;
    BOOL isLock;
    
    UIActivityIndicatorView *myActivityView;
    UIButton *btnCurtain;
}

@property (strong, nonatomic) IBOutlet UITableView *mainTableView;
@property (strong, nonatomic) IBOutlet UILabel *lbTitle;
@property (strong, nonatomic) IBOutlet UIButton *btnInspection;
@property (strong, nonatomic) IBOutlet UIButton *btnMaintenance;

//inspection objects
@property (strong, nonatomic) IBOutlet UIView *inspectionContainerView;
@property (strong, nonatomic) IBOutlet UILabel *lbInspectionItem;
@property (strong, nonatomic) IBOutlet UILabel *lbInspectionServiceType;
@property (strong, nonatomic) IBOutlet UILabel *lbInspectionResult;
@property (strong, nonatomic) IBOutlet UILabel *lbInspectionStartingDate;
@property (strong, nonatomic) IBOutlet UILabel *lbInspectionEndingDate;

//maintenance objects
@property (strong, nonatomic) IBOutlet UIView *maintenanceContainerView;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceItemID;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceItemType;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceType;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceStartingDate;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceEndingDate;
@property (strong, nonatomic) IBOutlet UILabel *lbMaintenanceStatus;

@property (strong, nonatomic) IBOutlet UIButton *btnAddNew;
@property (strong, nonatomic) IBOutlet UIButton *btnFilter;

@property (strong, nonatomic) IBOutlet UIView *titleContainerView;

- (IBAction)backPreviousView:(id)sender;
- (IBAction)switchSegment:(UIButton*)sender;
- (IBAction)handleAddNew:(id)sender;
- (IBAction)handleFilter:(UIButton*)sender;


//select Inspection or Maintenance
- (void) confirmSelectType:(NSMutableDictionary*)dict;

- (void) listInspection;

@end
